const fs=require('fs')
const path=require('path')

var pathFrom=path.join(__dirname,'/1.txt')
var pathTo=path.join(__dirname,'/8.txt')

var readStream=fs.createReadStream(pathFrom);
var writeStream=fs.createWriteStream(pathTo);

readStream.pipe(writeStream);

//在流操作完成之后获取原文件的权限
writeStream.on('end',()=>{
    var fileObj=fs.statSync(fileFrom)
    //赋予文件操作权限
    fs.chmodSync(pathTo,fileObj.mode)
})


